#-*-coding:utf-8-*-
import time
import Resources.UrlForTest
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class Page(object):
    """
    所有页面的父类
    """
    base_url=Resources.UrlForTest.urlForLbtLogin
    def __init__(self,selenium_driver,base_url=base_url,parent=None):
        self.base_url=base_url
        self.driver=selenium_driver
        self.timeout=10
        self.parent=parent
    def lbt_open(self,url):
        url=self.base_url+url
        self.driver.get(url)
        time.sleep(2)
        assert self.on_page(),'未完成登录%s' % url
    def open(self):
        self.lbt_open(self.url)
    def on_page(self):
        return (self.driver.current_url).__contains__(self.base_url)
    def script(self,src):
        return self.driver.execute_script(src)